﻿using System;
using System.Collections.Generic;
using PS4MacroAPI;

namespace ACE_Macro
{
    public class Script:ScriptBase
    {
        const int waitDeley = 1000;
        public Script()
        {
            Config.Name = "Ace Combat 7 ";

        }
        public override void Start()
        {
            base.Start();
        }
        public override void Update()
        {
            base.Update();
            retryMission();
            sortie();
            exitMission();
            enterMission();
        }

        void enterMission()
        {
            Press(new DualShockState() { Cross = true });//long day
            Sleep(10 * waitDeley);
            Press(new DualShockState() { Cross = true });//start mission
            Sleep(4 * waitDeley);
            Press(new DualShockState() { Cross = true });//mig-31
            Sleep(2 * waitDeley);
            Press(new DualShockState() { Cross = true });//laam
            Sleep(2 * waitDeley);
            Press(new DualShockState() { Cross = true });//sortie
            Sleep(25 * waitDeley);
        }
        void retryMission()
        {
            Press(new DualShockState() { Options = true });
            Sleep(2*waitDeley);
            Press(new DualShockState() { DPad_Down = true });
            Sleep(2*waitDeley);
            Press(new DualShockState() { Cross = true });
            Sleep(2*waitDeley);
            Press(new DualShockState() { DPad_Up = true });
            Sleep(2*waitDeley);
            Press(new DualShockState() { Cross = true });
            Sleep(3*waitDeley);
        }
        void exitMission()
        {
            Press(new DualShockState() { Options = true });
            Sleep(waitDeley);
            Press(new DualShockState() { DPad_Down = true });
            Sleep(waitDeley);
            Press(new DualShockState() { DPad_Down = true });
            Sleep(waitDeley);
            Press(new DualShockState() { Cross = true });
            Sleep(waitDeley);
            Press(new DualShockState() { DPad_Up = true });
            Sleep(waitDeley);
            Press(new DualShockState() { Cross = true });
            Sleep(20 * waitDeley);

        }
        void sortie()
        {
            PlayMacro("preprocess.xml");
            Sleep((int)(53.9614499 - 17.3328048)*1000);
            //System.IO.File.WriteAllText(@"D:\WriteText.txt", "AAA");
            Press(new DualShockState() { R1=true, R2 = 0xff },29*60*waitDeley);

        }
    }
}
